package Main;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Try7 {
    public static void main(String[] args) throws IOException {
        File file = new File("C:\\Users\\ruanjie\\Desktop\\outfittarget2.txt");
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        List<String> targetList = new ArrayList<>();
        String targetLine;
        while ((targetLine=reader.readLine())!=null){
            targetList.add(targetLine);
        }
        reader.close();

        File file2 = new File("C:\\Users\\ruanjie\\Desktop\\outfitsource2.txt");
        reader = new BufferedReader(new InputStreamReader(new FileInputStream(file2)));
        List<String> sourceList = new ArrayList<>();
        String sourceLine;
        while ((sourceLine=reader.readLine())!=null){
            sourceList.add(sourceLine);
        }



        File file3 = new File("C:\\Users\\ruanjie\\Desktop\\crosstest.txt");
        reader = new BufferedReader(new InputStreamReader(new FileInputStream(file3)));
        List<String> testSource = new ArrayList<>();
        List<String> testTarget = new ArrayList<>();
        String line;
        while ((line=reader.readLine())!=null){
            String[] strs = line.split(" ");
            testSource.add(strs[0]);
            testTarget.add(strs[1]);
        }

        File file4 = new File("C:\\Users\\ruanjie\\Desktop\\outfitmix2.txt");
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file4)));
        for (int i=0;i<sourceList.size();i++){
            for (int j=0;j<targetList.size();j++){
                bufferedWriter.write(testSource.get(Integer.valueOf(sourceList.get(i)))+" "+testTarget.get(Integer.valueOf(Integer.valueOf(targetList.get(j)))));
                bufferedWriter.newLine();
            }
        }
        bufferedWriter.close();
    }
}
